﻿using MenuService.Menu;
using MenuService.Menu.Dto;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;

namespace MenuService
{
    [RemoteService]
    [Area("menuService")]
    [Route("api/menuService/[controller]/[action]")]
    public class AbpMenuController : MenuServiceController, IAbpMenuAppService
    {
        private readonly IAbpMenuAppService _abpMenuAppService;

        public AbpMenuController(IAbpMenuAppService abpMenuAppService)
        {
            this._abpMenuAppService = abpMenuAppService;
        }
        [HttpPost]
        public async Task<MenuDto> CreateMenuAsync(MenuCreateOrUpdateDto input)
        {
            return await _abpMenuAppService.CreateMenuAsync(input);
        }
        [HttpDelete]
        public async Task DeleteMenuAsync(Guid id)
        {
            await _abpMenuAppService.DeleteMenuAsync(id);
        }
        [HttpGet("current")]
        public async Task<List<MenuDto>> GetCurrentUserMenuAsync()
        {
            return await _abpMenuAppService.GetCurrentUserMenuAsync();
        }
        [HttpGet("list")]
        public async Task<List<MenuDto>> GetListAsync()
        {
            return await _abpMenuAppService.GetListAsync();
        }
        [HttpPost]
        public async Task<MenuDto> UpdateMeunAsync(Guid id, MenuCreateOrUpdateDto input)
        {
            return await _abpMenuAppService.UpdateMeunAsync(id, input);
        }
    }
}
